<?php
$this->breadcrumbs=array(
	'Liên hệ',	
);
?>
<div class="">
	<!-- FORM CONTACT -->
    <div class="col-xs-5 col-left form-horizontal">
    	<div class=".col-md-9">
    	<p>Xin vui lòng sử dụng biểu mẫu dưới đây để gửi thông tin liên hệ, hoặc nếu bạn muốn liên hệ trực tiếp, vui lòng sử dụng địa chỉ ở cột bên</p>
 		</div>
    
    <?php if(Yii::app()->user->hasFlash('contact')): ?>

	<div class="flash-success">
		<?php echo Yii::app()->user->getFlash('contact'); ?>
	</div>

	<?php else: ?>
		<?php $form=$this->beginWidget('CActiveForm', array(
			'id'=>'contact-form-contact-form',
			// Please note: When you enable ajax validation, make sure the corresponding
			// controller action is handling ajax validation correctly.
			// See class documentation of CActiveForm for details on this,
			// you need to use the performAjaxValidation()-method described there.
			'enableAjaxValidation'=>false,
		)); ?>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-3 control-label">Họ và tên</label>
				<div class="col-sm-9">
					<?php echo $form->textField($model,'name',array('size'=>60,"class"=>"form-control")); ?>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-3 control-label">Email</label>
				<div class="col-sm-9">
					<?php echo $form->textField($model,'email',array('size'=>60,"class"=>"form-control")); ?>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-3 control-label">Số điện thoại</label>
				<div class="col-sm-9">
					<?php echo $form->textField($model,'phone',array('size'=>60,"class"=>"form-control")); ?>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-3 control-label">Liên hệ đến</label>
				<div class="col-sm-6">
					<?php echo $form->dropDownList($model,'toEmail',array('1' => 'Phòng kinh doanh', '2' => 'Phòng Marketting','3'=>'Phòng kỹ thuật','4'=>'Phòng khác'),array("class"=>"form-control")); ?>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-3 control-label">Tiêu đề</label>
				<div class="col-sm-9">
					<?php echo $form->textField($model,'subject',array('size'=>60,"class"=>"form-control")); ?>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-3 control-label">Nội dung</label>
				<div class="col-sm-9">
					<?php echo $form->textArea($model,'body',array( 'rows' => 8, 'cols' => 50,"class"=>"form-control")); ?>
				</div>
			</div>

			<div class="form-group">
				<label for="inputEmail3" class="col-sm-3 control-label "></label>
				<div class="col-sm-9">
					<?php echo CHtml::submitButton('Gửi',array( "class"=>"btn btn-create btn-login")); ?>
				</div>
			</div>

		<?php $this->endWidget(); ?>
	 <?php endif; ?>
    </div><!--END FORM CONTACT-->

    <!-- IN FOR -->
	 <div class="col-xs-4 col-middle">
	   <address>
		 	<p style="font-weight: bold;color: #2e8500;">Địa chỉ liên hệ:<br>
		 	Công ty Công nghệ DND Việt Nam</p>
		 	<div class="">
	  			<div class="col-xs-4 row" style="font-weight: bold;font-style:italic;text-decoration:underline;">Địa chỉ:</div>
	  			<div class="col-xs-8 row ">Phòng 1507, tòa nhà Trung Yên 1, <br>Đường Trung Yên,<br> Phường Yên Hòa,<br> Quận Cầu Giấy,<br> Hà Nội.</div>
	  		</div>
	  		<div class="">
	  			<div class="col-xs-4 row" style="font-weight: bold;font-style:italic;text-decoration:underline;">Địện thoại:</div>
	  			<div class="col-xs-8 row">0985.784.425</div>
	  		</div>
  	   </address>
  		<div class="clearfix visible-xs"></div>
  		<p>
  			<div id="map_canvas" style="margin:5px 5px 5px 5px; width:265px; height:315px;"></div>

  		</p>
	 </div>
	 <!-- End INFOR -->
    <div class="col-xs-3 col-left">
        
    </div>
</div>

	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 

<script type="text/javascript"> 
	var query = "Tòa Nhà Trung Yên 1, Vũ Phạm Hàm, Trung Hoà, Hanoi, Vietnam";
	var geocoder;
	var map;
	var adUnit;
	function initialize() {
	geocoder = new google.maps.Geocoder();
	var myOptions = {
	  streetViewControl: false,
	  draggable:true,
	  zoom: 15,
	  mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);  
	codeAddress();    
	}

	function codeAddress() {
	var address = query;
	geocoder.geocode( { 'address': address}, function(results, status) {
	  if (status == google.maps.GeocoderStatus.OK) {
		map.setCenter(results[0].geometry.location);
		var marker = new google.maps.Marker({
			map: map, 
			position: results[0].geometry.location
		});
	  } else {
		alert("Geocode was not successful for the following reason: " + status);
	  }
	});
	}
	google.maps.event.addDomListener(window, 'load', initialize);
</script> 